﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace IncrementalSave
{
    public static class PathHelper
    {
        public static string RemovePart(string originalPath, string partToRemove)
        {
            int startIndex = originalPath.IndexOf(partToRemove, StringComparison.Ordinal);
            if (startIndex == -1)
                return originalPath;
            string lastPart = originalPath.Substring(startIndex + partToRemove.Length);
            string firstPart = originalPath.Substring(0, startIndex);
            string result = Path.Combine(firstPart, lastPart.TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
            return result;
        }
    }
}
